package com.database;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;
/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class PoolConn {

  private static javax.sql.DataSource ds = null;
  private static Context ctx = null;
  private static boolean poolflag = false;

  public PoolConn() {
  }

  public static void initialDataSource() {
    if (!poolflag) {
      try {
        ctx = new InitialContext();
        ds = (javax.sql.DataSource) ctx.lookup("java:/MSSQLDS");
        poolflag = true;
      }
      catch (Exception e) {
        System.out.println("erro when connect to java naming api");
      }
    }
  }

  public static javax.sql.DataSource getDataSource() {
    return ds;
  }
}